package com.huike.web.controller.review;

import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.review.domain.Review;
import com.huike.review.service.ReviewService;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/review")


public class ReviewController extends BaseController {
    @Autowired
    private ReviewService reviewService;
    @GetMapping("getById")
    public AjaxResult FindById(Long id){
        Review byId = reviewService.findById(id);
        return AjaxResult.success(byId);
    }

    @PostMapping("saveData")
    public AjaxResult add(@RequestBody Review review){
        reviewService.add(review);
       return AjaxResult.success("添加成功");
    }

    @DeleteMapping("remove/{id}")
    public AjaxResult removeById(@PathVariable Long id){
        reviewService.remove(id);
        return AjaxResult.success(id);
    }
}
